<div class="wrapper wrapper-content animated fadeInRight">
    <!-- PAGE CONTENT BEGINS -->
    <div class="row">
        <div class="col-xs-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>搜索</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="table-responsive">
                            <form class="form-search" method="get" action="<?=url('hotelgw.order/index')?>"
                                  role="form">
                                <table>
                                    <tr>
                                        <td>
                                            会员:
                                            <input id="username" type="text" name="username"  value="<?=input('get.username')?>" placeholder="请单击选择会员"  class="form-control"/>
                                            <input type="hidden" value="<?=$search['user_id']?>" name="user_id" id="user_id">
                                            <button id="show-btn1" style="display: none" type="button" mini="load" w="95%" h="95%" href="<?=url('miniapp/user.user/select')?>" class="btn btn-w-m btn-info">选择酒店</button>
                                            <script>
                                                $("#username").focus(function () {
                                                    $("#show-btn1").click();
                                                })
                                                function seleUser(user_name,user_id){
                                                    layer.closeAll();
                                                    layer.msg('操作成功！');
                                                    $("#username").val(user_name);
                                                    $("#user_id").val(user_id);
                                                }
                                            </script>
                                        </td>
                                        <td>下单日期:
                                            <input style="height: 34px;" value="<?=empty($search['date']) ? '' :$search['date'] ?>" placeholder="下单日期" name="date" id="decoration_time" class="laydate-icon form-control layer-date">
                                            <script>
                                                laydate({
                                                    elem: '#decoration_time',
                                                    event: 'focus',
                                                    format: 'YYYY-MM-DD',
                                                    istime: true
                                                });
                                            </script>
                                        </td>
                                        <td>
                                            <div class="input-group">
                                                <button type="submit" style="margin-top: 42%"
                                                        class="btn form-control btn-sm btn-primary">
                                                    搜索
                                                </button>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="ibox-content">
                <div class="row">
                    <div class="table-responsive">
                        <table id="simple-table" class="table table-striped">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>会员</th>
                                <th>产品</th>
                                <th>订单金额</th>
                                <th>联系人</th>
                                <th>支付</th>
                                <th>状态</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <form id="mini_list">
                                <tbody>
                                <?php foreach($list as $val){ ?>
                                <tr>
                                    <td><?= $val->order_id ?></td>
                                    <td>
                                        <?=empty($user[$val->user_id]) ? '' : $user[$val->user_id]->nick_name  ?><br>
                                    </td>
                                    <td>

                                            房间订单：<?=empty($room[$val->room_id]) ? '' : $room[$val->room_id]->title ?><br>
                                            房间数：<?=$val->room_num?> (间)<br>

                                    </td>
                                    <td>
                                        总价格：<?=sprintf("%.2f",$val->total_price/100)?>￥<br>
                                        实际需要支付：<?=sprintf("%.2f",($val->total_price-$val->pay_coupon)/100 )?>￥<br>
                                    </td>
                                    <td>
                                        <?=$val->name?><br>
                                        <?=$val->mobile?>
                                    </td>
                                    <td>
                                        已支付：<?=sprintf("%.2f",$val->pay_money/100)?><br>
                                        优惠券：<?=sprintf("%.2f",$val->pay_coupon/100)?><br>

                                    </td>
                                    <td>
                                        创建时间：<?=date("Y-m-d H:i:s",$val->add_time)?><br>
                                        支付时间：<?=empty($val->pay_time) ? '未支付' : date("Y-m-d H:i:s",$val->pay_time)?>
                                    </td>
                                    <td>
                                        <?php if($val->status == 0){?>
                                        <span class="label label-sm label-warning">等待支付</span>
                                        <?php }?>
                                        <?php if($val->status == 1){?>
                                        <span class="label label-sm label-info">等待商家确认</span>
                                        <?php }?>
                                        <?php if($val->status == 2){?>
                                        <span class="label label-sm label-info">等待入住</span>
                                        <?php }?>
                                        <?php if($val->status == 3) { ?>
                                        <span class="label label-sm label-default">取消订单</span>
                                        <?php } ?>
                                        <?php if($val->status == 8){?>
                                        <span class="label label-sm label-success">订单已完成</span>
                                        <?php }?>
                                    </td>
                                    <td>
                                        <div class="hidden-sm hidden-xs btn-group">
                                            <a title="拒绝订单"   mini="load" w="50%" h="50%"  href="<?=url('hotelgw.order/cancel','order_id='.$val->order_id)?>" class="btn btn-xs btn-warning"><?=$val->status == 3 ? '查看拒绝原因' : '拒绝订单' ?></a>
                                            <?php if($val->status == 1) { ?>
                                            <a title="确认订单"   mini="act"  href="<?=url('hotelgw.order/orderyes','order_id='.$val->order_id)?>" class="btn btn-xs btn-info">接单</a>
                                            <?php }elseif($val->status == 2) {?>
                                            <a title="确认入住"   mini="act"   href="<?=url('hotelgw.order/orderok','order_id='.$val->order_id)?>" class="btn btn-xs btn-success">确认入住</a>
                                            <?php } ?>
                                        </div>
                                    </td>
                                </tr>
                                <?php } ?>
                                </tbody>
                            </form>
                        </table>
                        <div>
                            <?php echo $page; ?>
                        </div>
                    </div><!-- /.row -->
                </div><!-- /.main-container -->
            </div>
        </div>
    </div>
</div>
